<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script th:src="@{/static/reg/libs/jquery-1.12.4.min.js}" type="text/javascript" charset="utf-8"></script>
    <script th:src="@{/static/reg/js/jQuery/jquery-3.1.1.js}"></script>
    <title>注册页</title>
</head>
<body>
    <form action="/registry/in" method="post">
        用户名：<input type="text" name="username" placeholder="请输入用户名"><br>
        邮箱:<input type="text" id="userEmail" name="email" placeholder="请输入邮箱"><br>
        验证码:<input type="text" name="code" placeholder="请输入邮箱验证码">
        <a id="sendCode" style="color:red">获取验证码</a><br>
        密码：<input type="password" name="password" placeholder="请输入密码"><br>
        密码确认：<input type="password" name="confirmPassword" placeholder="请再次输入密码"><br>
        <input type="submit">
    </form>
<script type="text/javascript">
    $(function () {
        $("#sendCode").click(function () {
            //1、给指定邮箱发送验证码
            $.get("/sendCode?email=" + $("#userEmail").val(),function (data) {
                if (data.code == 401){
                    alert(data.info)
                }
            })
        })
    })
</script>
</body>
</html>
